# 导包
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
# 获取浏览器驱动
driver = webdriver.Firefox()
# 打开测试页面
url = 'file:///C:/Users/tedu/Desktop/NSD2406/html/registerA.html'
driver.get(url)
# 定位元素，执行相关操作
# 输入用户名，密码，电话，邮箱
username = driver.find_element(By.ID, 'userA')
username.send_keys('admin')
# 停顿3秒，重新换一个用户名
sleep(3)
# 清空
username.clear()
username.send_keys('hello')

driver.find_element(By.CSS_SELECTOR, '#passwordA').send_keys('123456')
driver.find_element(By.CLASS_NAME, 'telA').send_keys('19988889999')
driver.find_element(By.CSS_SELECTOR, '[name="emailA"]').send_keys('123@qq.com')
sleep(3)
driver.find_element(By.XPATH, '//button[@title="加入会员A"]').click()

# 关闭浏览器驱动
sleep(3)
driver.quit()